/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package net.hnilica.cisteniulic.dto;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

/**
 *
 * @author swosh
 */
@Entity
@IdClass(InfoId.class)
@Table(name = "info")
public class Info implements Serializable {

    private String email;
    private String nazUlice;

    public Info() {
    }

    public Info(String email, String nazUlice) {
        this.email = email;
        this.nazUlice = nazUlice;
    }

    @Id
    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Id
    @Column(name = "naz_ulice")
    public String getNazUlice() {
        return nazUlice;
    }

    public void setNazUlice(String nazUlice) {
        this.nazUlice = nazUlice;
    }

    public boolean equals(Object object) {
           if (this == object) {
            return true;
        }
        if (object == null || (object.getClass() != this.getClass())) {
            return false;
        }
        Info info = (Info) object;
        if (info.getEmail() == null || this.getEmail() == null) {
            return false;
        } else if (!info.getEmail().equalsIgnoreCase(this.getEmail())) {
            return false;
        } else {
            if (info.getNazUlice() == null || this.getNazUlice() == null) {
                return false;
            } else if (!info.getNazUlice().equalsIgnoreCase(this.getNazUlice())) {
                return false;
            } else {
                return true;
            }
        }
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 31 * hash + (null == email ? 0 : email.hashCode());
        hash = 31 * hash + (null == nazUlice ? 0 : nazUlice.hashCode());
        return hash;
    }

}
